package com.example.novelstory.service.qjl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.novelstory.dao.qjl.OrderDao;
import com.example.novelstory.entity.OrderInfo;
import java.util.Date;
import java.util.List;
import org.springframework.stereotype.Service;

@Service
public class OrderServiceImpl extends ServiceImpl<OrderDao, OrderInfo> {

    public List<OrderInfo> findAll2(){
        return list();
    }

    //添加

//    @Override
    public boolean save(OrderInfo orderInfo) {
        orderInfo.setCreatetime(new Date());
        return super.save(orderInfo);
    }

    //删除
    public boolean daleteOrder(int orderid){

        return removeById(orderid);

    }
    //修改
    public boolean updateOrder(OrderInfo orderInfo){

        QueryWrapper queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("username",orderInfo.getUsername());
        return update(orderInfo,queryWrapper);
    }
}
